package com.bci.pwtz.service;

import java.util.List;
import java.util.Map;

import com.bci.pwtz.common.util.PaginationList;
import com.bci.pwtz.exception.CanNotDeleteException;
import com.bci.pwtz.exception.PwtzDatabaseException;
import com.bci.pwtz.mysql.model.Company;

/**
 * 栏目服务 <br/>
 * <p>Description:<br/>
 *    <p>TODO 详细描述
 *
 * <p>For Examples <br/>
 * <PRE>
 * </PRE>
 * <p>
 */
public interface CompanyService
{
    /**
     * 
      * 根据用父级栏目ID获取栏目信息 <br/>
     * <p>Description: TODO(详细描述)
     * <br/>
     * <p>Author: tonic<br/>
     * <p>Date: 2014-9-16-下午2:15:15<br/>
     * <p>
     * @param pid
     * @param pageSize
     * @param pageNo
     * @return
     * @throws PwtzDatabaseException   
     *
     */
    List<Company> findCompanyByUserId(Long userId) throws PwtzDatabaseException;

    /**
     * 一句话描述 <br/>
     * <p>Description: TODO(详细描述) 
     * <br/>
     * <p>Author: tonic<br/>
     * <p>Date: 2014-9-18-下午3:10:51<br/>
     * <p>
     * @param company
     * @return
     * @throws PwtzDatabaseException   
     * 
     */
    Company add(Company company,int type) throws PwtzDatabaseException;
    
    String findChildrensId(Long companyid,Long userId) throws PwtzDatabaseException;

    /**
     * 一句话描述 <br/>
     * <p>Description: TODO(详细描述) 
     * <br/>
     * <p>Author: tonic<br/>
     * <p>Date: 2014-9-22-下午5:13:07<br/>
     * <p>
     * @param companyId
     * @return
     * @throws PwtzDatabaseException   
     * 
     */
    Company load(Long companyId) throws PwtzDatabaseException;

    /**
     * 一句话描述 <br/>
     * <p>Description: TODO(详细描述) 
     * <br/>
     * <p>Author: tonic<br/>
     * <p>Date: 2014-9-22-下午5:13:15<br/>
     * <p>
     * @param companyId
     * @return
     * @throws PwtzDatabaseException
     * @throws CanNotDeleteException   
     * 
     */
    int delete(Long companyId) throws PwtzDatabaseException;

    /**
     * 一句话描述 <br/>
     * <p>Description: TODO(详细描述) 
     * <br/>
     * <p>Author: tonic<br/>
     * <p>Date: 2014-9-22-下午5:13:29<br/>
     * <p>
     * @param company
     * @return
     * @throws PwtzDatabaseException   
     * 
     */
    int update(Company company) throws PwtzDatabaseException;

    /**
     * 一句话描述 <br/>
     * <p>Description: TODO(详细描述) 
     * <br/>
     * <p>Author: tonic<br/>
     * <p>Date: 2014-9-23-下午6:00:03<br/>
     * <p>
     * @param companyName
     * @param pageSize
     * @param pageNo
     * @return
     * @throws PwtzDatabaseException   
     * 
     */
    PaginationList<Company> findCompany(String companyName, int pageSize, int pageNo) throws PwtzDatabaseException;
    
    List<Map<String, Object>> findChildrens(Long companyid, int depth) throws PwtzDatabaseException;
    
    boolean checkSubCompanyValid(List<Map<String,Object>> companys,long checkCompanyId);
    public void sendJoinCompanyValidateSms(long companyUserId,long companyId,long auditId);
    public int selectCreateCompanyNumByUserId(long companyUserId)throws PwtzDatabaseException;
    void pushMessage(long companyUserId,long companyId);
    /**
     * 一句话描述 <br/>
     * <p>Description: TODO(详细描述) 
     * <br/>
     * <p>Author: tonic<br/>
     * <p>Date: 2014-10-15-下午2:03:25<br/>
     * <p>
     * @param userId
     * @param pageSize
     * @param pageNo
     * @return
     * @throws PwtzDatabaseException   
     * 
     */
    PaginationList<Company> findCompanyPageByUserId(Long userId, int pageSize, int pageNo) throws PwtzDatabaseException;

    /**
     * 一句话描述 <br/>
     * <p>Description: TODO(详细描述) 
     * <br/>
     * <p>Author: tonic<br/>
     * <p>Date: 2014-10-16-下午5:38:41<br/>
     * <p>
     * @param userId
     * @param pageSize
     * @param pageNo
     * @return
     * @throws PwtzDatabaseException   
     * 
     */
    PaginationList<Company> findMyCompany(Long userId, int pageSize, int pageNo) throws PwtzDatabaseException;
    
    boolean checkIsLowest(long companyId) throws PwtzDatabaseException;
    
    int selectCompanyCount(Long pid,String name)throws PwtzDatabaseException;
    
    public void updateVipExpireStatus() throws PwtzDatabaseException;
    
    public boolean isVip(Long companyId) throws PwtzDatabaseException;

    /**
     * 一句话描述 <br/>
     * <p>Description: TODO(详细描述) 
     * <br/>
     * <p>Author: tonic<br/>
     * <p>Date: 2015-1-21-下午2:40:50<br/>
     * <p>
     * @param companyid
     * @return
     * @throws PwtzDatabaseException   
     * 
     */
    String findChildren(Long companyid) throws PwtzDatabaseException;
}
